<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of category
 * 
 * @author Joydeb Choudhury(mcajoydeb@gmail.com)
 */
class Payment_gateway extends MY_Controller {

    //put your code here

    function Payment_gateway() {
        parent :: __construct();
        $this->load->model('payment_gateway_model');
        $this->template->set_theme('admin');
        $this->template->set_layout('admin_layout');
        $this->commoncall->check_admin_login();
    }

    function paypal() {
        $paypal = $this->payment_gateway_model->get_payment_gateway(2);
          if ($paypal) {
            $data['paypal_user'] = $paypal->user_id;
            $data['paypal_password'] = $paypal->password;
            $data['paypal_status'] = $paypal->status;
        }
      $this->template->title('Dashboard', $this->settings_model->get_setting('webtitle'))
                ->set_partial('admin_header', 'header/admin_header')
                ->set_partial('admin_left_menu', 'sidebar/admin_left_menu')
                ->build('pages/admin_paypal', $data);
       
    }

    function paypal_update() {
        $paypal_user_id = $_POST['paypal_user_id'];
        $paypal_password = $_POST['paypal_password'];
        $paypal_status = $_POST['paypal_status'];
        $paypal_data = array(
            'user_id' => $paypal_user_id,
            'password' => $paypal_password,
            'status' => $paypal_status
        );
        if ($this->config->item('mode') != 'DEMO')
            $this->db->update('payment_gateway', $paypal_data);

        redirect('admin/payment_gateway/paypal');
    }
    function authorized_dot_net(){
         $paypal = $this->payment_gateway_model->get_payment_gateway(1);
        if ($paypal) {
            $data['auth_user'] = $paypal->user_id;
            $data['auth_api'] = $paypal->api_id;
            $data['auth_transaction_key'] = $paypal->transaction_key;
            $data['auth_status'] = $paypal->status;
        }
        $this->template->title('Dashboard', $this->settings_model->get_setting('webtitle'))
                ->set_partial('admin_header', 'header/admin_header')
                ->set_partial('admin_left_menu', 'sidebar/admin_left_menu')
                ->build('pages/admin_authorized_dotnet', $data);
    }
     function autho_update() {
        $auth_user_id = $_POST['auth_user_id'];
        $auth_api = $_POST['auth_Api_id'];
        $auth_transaction = $_POST['auth_transaction_key'];
        $auth_status = $_POST['auth_status'];
        $auth_data = array(
            'user_id' => $auth_user_id,
            'api_id' => $auth_api,
            'transaction_key'=>$auth_transaction,
            'status' => $auth_status
        );
        if ($this->config->item('mode') != 'DEMO')
            $this->db->update('payment_gateway', $auth_data);

        redirect('admin/payment_gateway/authorized_dot_net');
    }

}

?>